"FLmatrix" = function(coords) { #L matrix of the thin-plate spline from a complex vector of landmarks # m1 <- rep(complex(real = 1., imag = 0.), length(coords)) m2 <- m1 %o% coords - coords %o% m1 m3 <- Re(m2 * Conj(m2)) m4 <- ifelse(m3 > 0., 0.5 * m3 * log(m3), 0.) m5 <- cbind(1., Re(coords), Im(coords)) rbind(cbind(m4, m5), cbind(t(m5), matrix(0., 3., 3.))) }